package com.situ.hr4.w.controller;

import com.situ.hr4.pojo.*;
import com.situ.hr4.w.service.RLZYservice;
import com.situ.hr4.w.service.ZWFBservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
//人力资源档案管理
public class RLZYcotroller {
    //人力资源档案管理设置

    @Autowired
    RLZYservice rlzy;
    @Autowired
    ZWFBservice zwfb;

    //Ⅰ级机构设置
    @RequestMapping("f")
    public String f(Map map){
        //全查一级结构
        List l=rlzy.yjjgqc();
        map.put("l",l );
        return "/page/client/first_kind.html";
    }

    //跳转到添加一级机构
    @RequestMapping("Wrlzy1")
    public String Wrlzy1(){
        return "page/client/first_kind_register.html";
    }

    //跳转到添加成功页面
    @RequestMapping("Wrlzy4")
    public String Wrlzy4(ConfigFileFirstKind fist){
        //添加一级机构
        rlzy.tjyjjg(fist);
        return "page/client/first_kind_register_success.html";
    }

    //跳转到修改一级机构
    @RequestMapping("Wrlzy2")
    public String Wrlzy2(int id,Map map){
        //根据id全查
        ConfigFileFirstKind l=rlzy.cxid(id);
        map.put("l",l );
        return "page/client/first_kind_change.html";
    }

    //修改一级机构
    @RequestMapping("Wrlzy5")
    public String Wrlzy5(ConfigFileFirstKind fist){
        //根据id修改
        rlzy.xgid(fist);
        return "page/client/first_kind_change_success.html";
    }

    //跳转到删除一级机构
    @RequestMapping("Wrlzy3")
    public String Wrlzy3(int id){
        //根据id删除一级机构
        rlzy.scyijg(id);
        return "page/client/first_delete_success.html";
    }






    //Ⅱ级机构设置
    @RequestMapping("f1")
    public String f1(Map map){
        //查询一级机构和二级机构
        List l=rlzy.cxyjej();
        map.put("l",l );
        return "/page/client/second_kind.html";
    }

    //跳转到添加第二机构页面
    @RequestMapping("Wdejg1")
    public String Wdejg1(Map map){
        //查询第一机构
        List l=zwfb.cx1();
        map.put("l", l);
        return "page/client/second_kind_register.html";
    }

    //跳转到添加成功的页面
    @RequestMapping("Wab1")
    public String Wab1(ConfigFileSecondKind second, Map map){
        //System.out.println(second.getFirst_kind_id());
        //添加第二机构表的信息
        rlzy.tjdejg(second);
        return "page/client/second_kind_register_success.html";
    }

    //跳转到第二机构修改界面
    @RequestMapping("Wab2")
    public String Wab2(int id,Map map){
        //根据id查询信息
        Map m=rlzy.cxid1(id);
        List l=zwfb.cx1();
        map.put("l", l);
        map.put("m",m );
        return "page/client/second_kind_change.html";
    }

    //跳转到修改成功页面
    @RequestMapping("Wab3")
    public String Wab3(ConfigFileSecondKind second,Map map){
        //根据id修改信息进入二级机构表中
        rlzy.xgid1(second);
        return "page/client/second_kind_change_success.html";
    }

    //跳转到删除成功页面
    @RequestMapping("Wab4")
    public String Wab4(int id,Map map){
        //根据id删除二级机构的信息
        rlzy.sc1(id);
        return "/page/client/second_delete_success.html";
    }







    //Ⅲ级机构设置
    @RequestMapping("f2")
    public String f2(Map map){
        //三表联查
        List l=rlzy.qc();
        map.put("l",l );
        return "/page/client/third_kind.html";
    }

    //跳转到添加界面
    @RequestMapping("Wac1")
    public String Wac1(Map map){
        //查询一级结构,绑
        List<ConfigFileFirstKind> list=zwfb.cx1();
        map.put("list",list );
        return "page/client/third_kind_register.html";
    }

    //跳转到添加成功的界面
    @RequestMapping("Wac2")
    public String Wac2(ConfigFileThirdKind thire){
        //添加第三机构的信息
        rlzy.tj(thire);
        return "page/client/third_kind_register_success.html";
    }
    //跳转到修改界面
    @RequestMapping("Wac3")
    public String Wac3(int id,Map map){
        //根据id查询详细信息
        Map m=rlzy.cxxq(id);
        map.put("l",m );
        return "page/client/third_kind_change.html";
    }
    //跳转到修改成功界面
    @RequestMapping("Wac4")
    public String Wac4(ConfigFileThirdKind thire){
        //System.out.println(thire.getThird_kind_id()+thire.getThird_kind_sale_id()+thire.getThird_kind_is_retail());
        //根据id修改
        rlzy.xgid2(thire);
        return "page/client/third_kind_change_success.html";
    }
    //跳转到删除成功界面
    @RequestMapping("Wac5")
    public String Wac5(int id){
        //根据id删除
        rlzy.sc2(id);
        return "page/client/third_delete_success.html";
    }








    //职称设置
    @RequestMapping("f3")
    public String f3(Map map){
        //职位名称全查
        List l=rlzy.zwmcqc();
        map.put("l",l );
        return "/page/client/profession_design.html";
    }

    //职位名称删除
    @RequestMapping("f31")
    public String f31(int id){
        //根据id删除
        rlzy.sczwmc(id);
        return  "redirect:f3";
    }





    //职位分类设置
    @RequestMapping("f4")
    public String f4(Map map){
        //职位分类全查
        List<ConfigMajorKind> l=rlzy.zwflqc();
        map.put("l",l );
        return "/page/client/major_kind.html";
    }

    //跳转到添加界面
    @RequestMapping("f41")
    public String f41(){
        return "page/client/major_kind_add.html";
    }

    //添加成功跳转首页
    @RequestMapping("f42")
    public String f42(ConfigMajorKind cmk){
        //添加职位分类
        rlzy.tjzwfl(cmk);
        return  "redirect:f4";
    }

    //删除成功跳转首页
    @RequestMapping("f43")
    public String f43(int id){
        //根据id删除职位分类
        rlzy.sczwfl(id);
        return  "redirect:f4";
    }




    //职位设置
    @RequestMapping("f5")
    public String f5(Map map){
        //全查职位设置
        List<Map> l=rlzy.qczwsz();
        map.put("l",l );
        return "/page/client/major.html";
    }

    //跳转到添加界面
    @RequestMapping("f51")
    public String f51(Map map){
        //职位分类查询,绑
        List<ConfigMajorKind> zwfl=zwfb.cxzwfl();
        map.put("zwfl",zwfl );
        return "page/client/major_add.html";
    }

    //添加成功跳转到首页
    @RequestMapping("f52")
    public String f52(ConfigMajor cm){
        //添加职位设置
        rlzy.tjzwsz(cm);
        return  "redirect:f5";
    }

    //删除成功后跳转首页
    @RequestMapping("f53")
    public String f53(int id){
        //根据id删除职位设置
        rlzy.sczwsz(id);
        return  "redirect:f5";
    }





    //公共属性设置
    @RequestMapping("f6")
    public String f6(Map map){
        //全查公共属性设置
        List<ConfigPublicChar> l=rlzy.qcggsx();
        map.put("l", l);
        return "/page/client/public_char.html";
    }

    //跳转到添加公共属性设置页面
    @RequestMapping("f61")
    public String f61(){
        return "/page/client/public_char_add.html";
    }

    //添加成功跳转首页
    @RequestMapping("f62")
    public String f62(ConfigPublicChar cpc){
        //添加公共属性
        rlzy.tjggsx(cpc);
        return "redirect:f6";
    }

    //删除成功跳转首页
    @RequestMapping("f63")
    public String f63(int id){
        //根据id删除公共属性
        rlzy.scggsx(id);
        return "redirect:f6";
    }
}
